package com.itic.market.system.tixian.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.itic.appbase.framework.common.service.CrudService;
import com.itic.appbase.framework.utils.NumberStringHelper;
import com.itic.appbase.framework.utils.StringHelper;
import com.itic.market.system.tixian.persistence.dao.TixianDao;
import com.itic.market.system.tixian.persistence.model.Tixian;
import com.itic.market.system.tixian.persistence.model.TixianExample;
import com.itic.market.system.user.persistence.dao.MarketUserDao;
import com.itic.market.system.user.persistence.model.MarketUser;


@Service
@Transactional
public class TixianService
     extends CrudService<TixianDao,Tixian,TixianExample> {
    @Autowired
    private TixianDao tixianDao;
    @Autowired
    private MarketUserDao marketUserDao;
    
	public String falseee(Tixian temp) {
		MarketUser user = marketUserDao.selectByPrimaryKey(temp.getUserId());
		String money = "0";
		if( StringHelper.isNotBlank(user.getMoney()) ){
			money = user.getMoney();
		}
		money = NumberStringHelper.addString(money, temp.getMoney());
		user.setMoney(money);
		marketUserDao.updateByPrimaryKeySelective(user);
		tixianDao.updateByPrimaryKeySelective(temp);
		return SUCCESS;
	}


}